import urllib

import pandas as pd
from matplotlib import pyplot as plt
import mpl_finance as mpf
from matplotlib.pylab import date2num
from pylab import *
import os







#%matplotlib inline
from wx.lib.agw.shortcuteditor import DATA_DIR


class ResultDraw():
     data = pd.read_csv('my_csv.csv')
    
     quotes = []
     vols = []
     x =[]
     data_list = []
         
     #dataform 转成list   
     train_data = np.array(data)#np.ndarray()
     train_x_list=train_data.tolist()#list

     def download_163(datadir, code, dtype, start):
         print('download: %s' % code)

         # 上证指数000001前加0，沪深300指数000300股票前加0，
         # 深证成指399001前加1，中小板指399005前加1，创业板指399006前加1
         #url = "https: //xueqiu.com/stock/forchartk/stocklist.json?symbol = SH600756&period = 1day&type = before&begin = 1478620800000&end = 1510126200000&_= 1510126200000"
         url = "https://xueqiu.com/stock/forchartk/stocklist.json?symbol=SH600756&period=1day&type=before&begin=1478620800000&end=1510126200000&_=1510126200000"
         path = os.path.join(datadir, code + '_163.csv')
         urllib.request.urlretrieve(url, path)
         return path

     path = download_163(DATA_DIR, '002230', '1', '2009-01-01')
     df = pd.read_csv(path, encoding='gbk')
     df.tail()
     pd.set_option('display.max_columns', None)
     print(df)





